import { connect } from "react-redux";

import { setToken } from "./store/actions";

function App({ token, setToken }) {
  return (
    <div>
      <h1>App</h1>
      <p>TOKEN: {token}</p>

      <button onClick={() => setToken("张三")}>token = 张三</button>
      <button onClick={() => setToken("李四")}>token = 李四</button>
    </div>
  );
}

export default connect(
  (state) => ({
    token: state.user.token,
  }),
  {
    setToken,
  }
)(App);
